package basic.fastdfs;

import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.core.io.ClassPathResource;

public class FastDFSLoad {
	
	
	public static StorageClient load(){
		ClassPathResource cpr = new ClassPathResource("fdfs_client_old.conf");
		String path = cpr.getClassLoader().getResource("fdfs_client_old.conf").getPath();
		try {
			ClientGlobal.init(path);
			TrackerClient trackerClient=new TrackerClient();
			TrackerServer trackerServer = trackerClient.getConnection();
			StorageServer storageServer=null;
			StorageClient storageClient=new StorageClient(trackerServer, storageServer);
			return storageClient;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
